<template>
    <div class="com-img" @click="changeCode">
        <img :src="valiecodeUrl" >
    </div>
</template>
<script>
export default {
   name: 'valicode',
    data() {
        return {
            random: Math.random(),
            comlist: [],
        }
    },
    computed: {
        valiecodeUrl() {
            var host=this.$setting.gbs.host !="/" ? this.$setting.gbs.host :'';
             return host + "/valicode/get?host="+location.hostname+"&r=" + this.random;
            // return process.env.UPLOAD_PATH + "/valicode/get?host="+location.hostname+"&r=" + this.random;
        }
    },
    methods: {
        changeCode() {
            this.random = Math.random();
        }
    },
    mounted() {
        // this.changeCode();
        //console.log(this.$setting.gbs)
    },
    created() {
        this.$bus.on('changeCode', this.changeCode);
    },
    beforeDestroy() {
        this.$bus.off('changeCode', this.changeCode);
    },
}
</script>
<style scoped>
.com-img {
    display: inline-block;
    height: 32px;
    line-height: 32px;
    position: relative;
    vertical-align: middle;
    width: 80px;
    border: 1px solid #9ea7b4;
    border-radius: 4px;
    overflow: hidden;
    cursor: pointer;
    margin-top: 1px;
}
</style>
